package com.yihu.cms.service;

import java.io.IOException;
import java.net.MalformedURLException;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.yihu.beans.products.CommodityCategory;
import com.yihu.dataService.hessian.mongodb.interfaceService.CommodityCategoryHService;
import com.yihu.dataService.hessian.resource.ResourceMongoDBManager;

public class CommodityCategoryService {
	
	protected final Logger log = LoggerFactory.getLogger(this.getClass());
	
	public List<CommodityCategory> getCommodityCategory() {
		List<CommodityCategory> result = null;
		try {
			CommodityCategoryHService cchs = (CommodityCategoryHService) ResourceMongoDBManager
					.getSingleton().getBeans("commodityCategoryHSC");
			result = cchs.getCommodityCategory();
		} catch (MalformedURLException e) {
			log.error("error=" + e.toString());
		} catch (IOException e1) {
			e1.printStackTrace();
		}
		return result;
	}
	
	public List<CommodityCategory> getCommodityCategoryBypId(String pId) {
		List<CommodityCategory> result = null;
		try {
			CommodityCategoryHService cchs = (CommodityCategoryHService) ResourceMongoDBManager
					.getSingleton().getBeans("commodityCategoryHSC");
			result = cchs.getCommodityCategoryBypId(pId);
		} catch (MalformedURLException e) {
			log.error("error=" + e.toString());
		} catch (IOException e1) {
			e1.printStackTrace();
		}
		return result;
	}

}
